#include<iostream>
#include<algorithm>
using namespace std;

typedef long long ll;
ll money=20,  path;
int n, w;
const int N=20;
int arr[N], b[N];

bool cmp(int x, int y)
{
	return x>y;
}

void dfs(int pos)
{
	if(path > money) return;
	if(pos>n) 
	{
		money=path;
		return ;
	}
	
	for(int i=1; i<=path; i++)
	{
		if(b[i]+arr[pos] > w) continue;
		b[i]+=arr[pos];
		dfs(pos+1);
		b[i]-=arr[pos];
	}
	
	path++;
	b[path]+=arr[pos];
	dfs(pos+1);
	b[path]-=arr[pos];
	path--;
}
int main()
{
	cin>>n>>w;
	for(int i=1; i<=n; i++) cin>>arr[i];
	sort(arr+1, arr+n+1, cmp);
	
	dfs(1);
	cout<<money;
	return 0;
}
